#ifndef ESDL_draw_h
#define ESDL_draw_h

#include <SDL/SDL.h>
#include "sprite.h"

typedef SDL_Color EsdlColor;

/** 
 * @brief Keep a color in memory for the next operations
 * @param Uint8 red - 
 * @param Uint8 green - 
 * @param Uint8 blue -
 */
EsdlColor esdlCreateColor(Uint8 red, Uint8 green, Uint8 blue);

/**
 * @brief Fill the sprite with a specific color
 * @param Sprite* sprite - The sprite to fill
 * @param Color color - The color
 */
void esdlFillSprite(EsdlSprite* sprite, EsdlColor color);

/**
 * @brief Draw a line on a sprite
 * @param Sprite * sprite - The sprite on which the line will be drawn
 * @param unsigned int x1 - The abscissa coordonate of the starting point of the line
 * @param unsigned int y1 - The ordinate coordonate of the starting point of the line
 * @param unsigned int x2 - The abscissa coordonate of the ending point of the line
 * @param unsigned int y2 - The ordinate coordonate of the ending point of the line
 * @param Color color - The color of the line
 * @param unsigned int thickness - The thickness of the line
 */
void esdlDrawLine(EsdlSprite* sprite, 
        unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
        EsdlColor color, unsigned int thickness);

/**
 * @brief Draw a circle on a sprite
 * @param Sprite * sprite - The sprite on which the circle will be drawn
 * @param unsigned int x_centre - The abscissa coordonate of the center of the circle
 * @param unsigned int y_centre - The ordinate coordonate of the center of the circle
 * @param unsigned int radius - The radius of the circle
 * @param Color color - The color of the circle
 */
void esdlDrawCircle(EsdlSprite* sprite, 
        unsigned int x_centre, unsigned int y_centre, unsigned int radius,
        EsdlColor color);

/**
 * @brief Draw a filled circle on a sprite
 * @param Sprite * sprite - The sprite on which the line will be drawn
 * @param unsigned int x_centre - The abscissa coordonate of the center of the circle
 * @param unsigned int y_centre - The ordinate coordonate of the center of the circle
 * @param unsigned int radius - The radius of the circle
 * @param Color color - The color of the circle
 */
void esdlDrawFilledCircle(EsdlSprite* sprite, 
        unsigned int x_centre, unsigned int y_centre, unsigned int radius, 
        EsdlColor color);

/**
 * @brief Draw an ellipse on a sprite
 * @param Sprite * sprite - The sprite on which the ellipse will be drawn
 * @param unsigned int x_centre - The abscissa coordonate of the center of the ellipse
 * @param unsigned int y_centre - The ordinate coordonate of the center of the ellipse
 * @param unsigned int radius_x - The x radius of the ellipse
 * @param unsigned int radius_y - The y radius of the ellipse
 * @param Color color - The color of the circle
 */
void esdlDrawEllipse(EsdlSprite* sprite, 
        unsigned int x_centre, unsigned int y_centre, 
        unsigned int radius_x, unsigned int radius_y, 
        EsdlColor color);

/**
 * @brief Draw a filled ellipse on a sprite
 * @param Sprite * sprite - The sprite on which the ellipse will be drawn
 * @param unsigned int x_centre - The abscissa coordonate of the center of the ellipse
 * @param unsigned int y_centre - The ordinate coordonate of the center of the ellipse
 * @param unsigned int radius_x - The x radius of the ellipse
 * @param unsigned int radius_y - The y radius of the ellipse
 * @param Color color - The color of the circle
 */
void esdlDrawFilledEllipse(EsdlSprite* sprite, 
        unsigned int x_centre, unsigned int y_centre, 
        unsigned int radius_x, unsigned int radius_y, 
        EsdlColor color);

/**
 * @brief Draw a rectangle on a sprite
 * @param Sprite* sprite - The sprite on which the rectangle will be drawn
 * @param unsigned int x - The abscissa coordonate of the top left point of the rectangle
 * @param unsigned int y - The ordinate coordonate of the top left point of the rectangle
 * @param unsigned int width - The width of the rectangle
 * @param unsigned int height - The height of the rectangle
 * @param Color color - The color of the rectangle
 * @param unsigned int thickness - The thickness of the rectangle
 */
void esdlDrawRectangle(EsdlSprite* sprite, 
        unsigned int x, unsigned int y, unsigned int width, unsigned int height,
        EsdlColor color, unsigned int thickness);

/**
 * @brief Draw a filled rectangle on a sprite
 * @param Sprite* sprite - The sprite on which the rectangle will be drawn
 * @param unsigned int x - The abscissa coordonate of the top left point of the rectangle
 * @param unsigned int y - The ordinate coordonate of the top left point of the rectangle
 * @param unsigned int width - The width of the rectangle
 * @param unsigned int height - The height of the rectangle
 * @param Color color - The color of the rectangle
 */
void esdlDrawFilledRectangle(EsdlSprite* sprite, 
        unsigned int x, unsigned int y, unsigned int width, unsigned int height, 
        EsdlColor color);

/**
 * @brief Color a pixel on a sprite
 * @param Sprite* sprite - The sprite on which the pixel will be drawn
 * @param unsigned int x - The abscissa coordonate of the pixel
 * @param unsigned int y - The ordinate coordonate of the pixel
 * @param Color color - The color of the pixel
 */
void esdlSetPixel(EsdlSprite* sprite, unsigned int x, unsigned int y, EsdlColor color);

/**
 * @param Sprite* sprite - The sprite on which the pixel color has to be read
 * @param unsigned int x - The abscissa coordonate of the pixel
 * @param unsigned int y - The ordinate coordonate of the pixel
 * @return the color of the spotted pixel
 */
EsdlColor esdlGetPixel(const EsdlSprite* sprite, unsigned int x, unsigned int y);

#endif

